ci: publish to npm via OIDC trusted publishing#503
Conversation
The Release JS workflow has failed every publish since 2026-05-04 with E404 on PUT for all packages — the npm signature for a rejected token. The publish credential (NPM_TOKEN) is no longer accepted by the registry. Complete the migration to npm OIDC trusted publishing that the workflow was already half-configured for (id-token: write was present): - Drop NPM_TOKEN from the publish step env. changesets/action only writes its token .npmrc when NPM_TOKEN is set, so removing it lets `changeset publish` authenticate via OIDC. Leaving it set shadows OIDC and 404s (npm/cli#8976). - Upgrade npm to >= 11.5.1 in CI; OIDC trusted publishing needs it and Node 22 ships npm 10.x. - Fix repository.url across all publishable packages (most pointed at the old cipherstash/protectjs; some were missing). OIDC publishing generates provenance, which requires repository.url to match the building repo. Requires a trusted publisher configured on npmjs.com for each package (org: cipherstash, repo: stack, workflow: release.yml).
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✅ Files skipped from review due to trivial changes (6)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR switches the release workflow to OIDC-based npm publishing (adds npm upgrade step, removes NPM_TOKEN) and updates package.json metadata across packages to point repository/bugs fields to cipherstash/stack and add repository.directory entries. ChangesRepository Migration to cipherstash/stack with OIDC Publishing
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (1)
.github/workflows/release.yml (1)
49-52: ⚡ Quick winPin npm for trusted publishing to the npm 11.x line (>= 11.5.1) instead of
latest.Trusted publishing requires npm CLI 11.5.1+ (and Node.js 22.14.0+). Using
npm@latestcan pull a future npm major and change release behavior without any workflow change.Suggested change
- - name: Upgrade npm for OIDC trusted publishing - run: npm install -g npm@latest + - name: Upgrade npm for OIDC trusted publishing + run: npm install -g npm@^11.5.1🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/release.yml around lines 49 - 52, The workflow step named "Upgrade npm for OIDC trusted publishing" should pin npm to the 11.x line instead of using npm@latest; change the run command from "npm install -g npm@latest" to a version-constrained install such as "npm install -g npm@^11.5.1" (or "npm@>=11.5.1 <12") so the CI uses npm CLI 11.5.1+ but never jumps to npm 12+, preserving trusted OIDC publishing behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/drizzle/package.json`:
- Around line 17-20: The package.json still points bugs.url at the old
cipherstash/protectjs tracker; update the "bugs.url" field to the new repository
(match the "repository.url")—set bugs.url to
"https://github.com/cipherstash/stack/issues" so issues open against the
migrated repo; edit the package.json entry for bugs.url accordingly.
In `@packages/nextjs/package.json`:
- Around line 14-17: Update the package.json to migrate the bugs.url to match
the new repository.url: open the package.json where "repository.url" is set to
"git+https://github.com/cipherstash/stack.git" and change the "bugs.url" value
(currently pointing to the old cipherstash/protectjs tracker) to the new
repository's issues URL (https://github.com/cipherstash/stack/issues) so both
repository.url and bugs.url reference the same project.
In `@packages/protect-dynamodb/package.json`:
- Around line 16-19: The package.json currently sets the repository to
cipherstash/stack but still points npm bugs to the old project; add a bugs field
next to the existing repository object (key "bugs") and set its "url" to
"https://github.com/cipherstash/stack/issues" so npm metadata routes issues to
the correct repo; update the package.json near the "repository" object to
include the new "bugs" key.
In `@packages/protect/package.json`:
- Around line 16-19: Update the package metadata so the bugs URL points to the
new repository; specifically, change the "bugs.url" field in package.json from
the old cipherstash/protectjs issues URL to the new cipherstash/stack issues URL
(or remove/redirect it if intentional), ensuring the "bugs" object aligns with
the "repository" object that references "cipherstash/stack" so npm users are
directed to the correct issue tracker.
In `@packages/schema/package.json`:
- Around line 14-17: The package.json still points its issue tracker to the old
repo; update the bugs.url field in packages/schema/package.json to the new
repository's issues URL (e.g., set "bugs": { "url":
"https://github.com/cipherstash/stack/issues" }) so it matches the declared
"repository" object and completes the migration.
In `@packages/stack/package.json`:
- Line 18: The package.json still has an outdated bugs.url pointing to
cipherstash/protectjs; update the bugs.url field to the migrated repository
(matching the new repository.url value cipherstash/stack) by replacing the old
issues URL with the new repository's issues URL (e.g.,
"https://github.com/cipherstash/stack/issues") so package metadata is
consistent; verify the change in the package.json's "bugs" object alongside the
existing "repository.url" entry.
---
Nitpick comments:
In @.github/workflows/release.yml:
- Around line 49-52: The workflow step named "Upgrade npm for OIDC trusted
publishing" should pin npm to the 11.x line instead of using npm@latest; change
the run command from "npm install -g npm@latest" to a version-constrained
install such as "npm install -g npm@^11.5.1" (or "npm@>=11.5.1 <12") so the CI
uses npm CLI 11.5.1+ but never jumps to npm 12+, preserving trusted OIDC
publishing behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 46c70109-171e-48b7-918b-6d44a56628bb
📒 Files selected for processing (10)
.github/workflows/release.ymlpackages/cli/package.jsonpackages/drizzle/package.jsonpackages/migrate/package.jsonpackages/nextjs/package.jsonpackages/protect-dynamodb/package.jsonpackages/protect/package.jsonpackages/schema/package.jsonpackages/stack/package.jsonpackages/wizard/package.json
Address review feedback on the OIDC publishing migration: - bugs.url across the migrated packages still referenced the old cipherstash/protectjs tracker; align with repository.url. - Pin the CI npm upgrade to npm@^11.5.1 so trusted publishing keeps a known-good major and never jumps to npm 12+ unattended.
Problem
The Release JS workflow has failed every npm publish since 2026-05-04. All packages fail identically:
An
E404on aPUTis npm's signature for a rejected credential, not a missing package — a real "missing package" can't 404 an existing package like@cipherstash/protect, and a version clash would be409. TheNPM_TOKENis no longer accepted by the registry (consistent with npm's revocation of legacy publish tokens).It looked intermittent because the workflow runs on every push to
mainbut only exercises the credential when achangeset-releasePR merges; plain feature merges are no-op publishes that pass.As a result these versions are bumped and tagged but never published:
protect@12.0.0,protect-dynamodb@12.0.0,schema@3.0.0,stack@0.18.0,wizard@0.3.0,prisma-next@0.3.1,stash@0.16.0.Fix
Complete the migration to npm OIDC trusted publishing that the workflow was already half-configured for (
id-token: writewas present):NPM_TOKENfrom the publish env.changesets/actiononly writes its token.npmrcwhenNPM_TOKENis set (guarded since v1.7.0), so removing it letschangeset publishauthenticate via OIDC. Leaving it set shadows OIDC and 404s — see npm/cli#8976.repository.urlacross all publishable packages. Most pointed at the oldcipherstash/protectjs; three were missing. OIDC publishing auto-generates provenance, which requiresrepository.urlto match the building repo or the publish fails.pnpm run lint:workflow-cache(the supply-chain cache gate) still passes.Required before merge — npmjs.com config
Configure a Trusted Publisher for each package: Settings → Trusted Publisher → GitHub Actions → org
cipherstash, repostack, workflowrelease.yml, environment (blank).Pending versions (must be set before merge):
@cipherstash/protect,@cipherstash/protect-dynamodb,@cipherstash/schema,@cipherstash/stack,@cipherstash/wizard,@cipherstash/prisma-next,stash.No pending version this cycle but configure for future releases:
@cipherstash/drizzle,@cipherstash/nextjs,@cipherstash/migrate.Sequencing
mainauto-triggers Release, which publishes the pending versions via OIDC.NPM_TOKENsecret (no other workflow references it).Summary by CodeRabbit